import request from '@/utils/request.js'
import requestReport from '@/utils/requestReport.js'

export default {
    //报表查询
    statisticsReport(params) {
        return request({
            url: '/v3/energy/dataQuery/statisticsReport',
            method: 'GET',
            params: {
                ...params,
                organizationNo: sessionStorage.organizationNo
            }
        })
    },
    //日报表
    dayReport(data) {
        return request({
            url: '/v3/energy/dataQuery/dayReport',
            method: 'POST',
            data
        })
    },
    //周/月/自选时间报表
    longReport(data) {
        return request({
            url: '/v3/energy/dataQuery/longReport',
            method: 'POST',
            data
        })
    },
    //年报表
    yearReport(data) {
        return request({
            url: '/v3/energy/dataQuery/yearReport',
            method: 'POST',
            data
        })
    },
    //能源总览接口
    energyOverview() {
        return request({
            url: `/v3/energy/dataQuery/energyOverview?organizationNo=${sessionStorage.organizationNo}`,
            method: 'GET'
        })
    },
    // 能耗趋势分析接口，type=1当日 2当月 3当年
    energyConsumptionTrendAnalysis(params) {
        return request({
            url: '/v3/energy/dataQuery/energyConsumptionTrendAnalysis',
            method: 'GET',
            params: {
                ...params,
                organizationNo: sessionStorage.organizationNo
            }
        })
    },
    //查询本月能耗分布情况接口
    monthConsumption(params) {
        return request({
            url: '/v3/energy/dataQuery/monthConsumption',
            method: 'GET',
            params: {
                ...params,
                organizationNo: sessionStorage.organizationNo
            }
        })
    },
    //能耗用量查询接口
    queryConsumption(params) {
        return request({
            url: '/v3/energy/dataQuery/queryConsumption',
            method: 'GET',
            params: {
                ...params,
                organizationNo: sessionStorage.organizationNo
            }
        })
    },
    //当天能耗用量接口
    todayUse(params) {
        return request({
            url: '/v3/energy/dataQuery/todayUse',
            method: 'GET',
            params: {
                ...params,
                organizationNo: sessionStorage.organizationNo
            }
        })
    },
    //当月能耗用量接口
    monthUse(params) {
        return request({
            url: '/v3/energy/dataQuery/monthUse',
            method: 'GET',
            params: {
                ...params,
                organizationNo: sessionStorage.organizationNo
            }
        })
    },
    //能耗对比接口
    energyContrast(data) {
        return request({
            url: '/v3/energy/dataQuery/energyContrast',
            method: 'POST',
            data: {
                ...data,
                organizationNo: sessionStorage.organizationNo
            }
        })
    },
    // 日报表导出
    exportDayReport(data) {
        return requestReport({
            url: '/v3/energy/dataQuery/exportDayReport',
            method: 'POST',
            responseType: 'blob',
            data
        })
    },
    //周/月/自选时间报表导出
    exportLongReport(data) {
        return requestReport({
            url: '/v3/energy/dataQuery/exportLongReport',
            method: 'POST',
            responseType: 'blob',
            data
        })
    },
    //年报表导出
    exportYearReport(data) {
        return requestReport({
            url: '/v3/energy/dataQuery/exportYearReport',
            method: 'POST',
            responseType: 'blob',
            data
        })
    },
}
